home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 …SCII & the Runetime Code / ADC Developer CD (1992-07) (''Butch ASCII And The Runtime Code'')_iso / Dev.CD 199207.iso / Tools & Apps / Devices & Hardware / A⁄ROSE / MessageDispatcher / MultiThread.a < prev    next >
Encoding:
Text File  |  1991-04-25  |  3.3 KB  |  181 lines  |  [TEXT/MPS ]

  1. *
  2. *    Beginning of the 'mlti' resource
  3. *    
  4. *    Written by:    Anumele D. Raja
  5. *    
  6. *    Date:        March 19, 1991
  7. *    
  8. *    Copyright @ Apple Computer, Inc.  1991
  9. *
  10. *
  11. *    Revision History
  12. *
  13. *        Raja        04/19/91        Added code to handle message dispatching
  14. *
  15.         Case    On
  16.         Print    Off
  17.         Include    'Traps.a'
  18.         Print    On
  19. *
  20. *    Setup - Macro to initialize address table
  21. *
  22.         Macro
  23.         Setup    &Name
  24.         Print    Push, NoGen
  25.         Import    &Name
  26.         LEA        &Name, A0
  27.         Move.L    A0, D0
  28.         _StripAddress
  29.         Move.L    D0, (A1)+
  30.         Print    Pop
  31.         EndM
  32. *
  33. *    SetupLabel - Macro to initialize address table labels
  34. *
  35.         Macro
  36.         SetupLabel    &Name
  37.         Print    Push, NoGen
  38.         Export    a&Name
  39. a&Name    Ds.L    1                    ; place for the address of the routine
  40.         Print    Pop
  41.         EndM
  42. *
  43. *  Macro to generate MacsBug like symbols
  44. *
  45.         Macro
  46.         SubrName    &Symbol
  47.         String    AsIs
  48.         Dc.B    &Len(&Symbol)+$80
  49.         Dc.B    '&Symbol'
  50.         Dc.W    0
  51.         EndM
  52. *
  53. *    Entry    
  54. *
  55. *        Name = Name of entry point.
  56. *
  57. CallAddress    Main
  58. *
  59. *  Instructions to set up the table
  60. *
  61. SetupAddresses
  62.         Lea        Addresses, A1
  63. *
  64.         Setup    CloseQueue
  65.         Setup    FreeMsg
  66.         Setup    GetCard
  67.         Setup    GetETick
  68.         Setup    GetICCTID
  69.         Setup    GetIPCg
  70.         Setup    GetMsg
  71.         Setup    GetNameTID
  72.         Setup    GetTickPS
  73.         Setup    GetTID
  74.         Setup    IsLocal
  75.         Setup    KillReceive
  76.         Setup    LockRealArea
  77.         Setup    Lookup_Task
  78.         Setup    NetCopy
  79.         Setup    OpenQueue
  80.         Setup    Receive
  81.         Setup    Register_Task
  82.         Setup    Send
  83.         Setup    SwapTID
  84.         Setup    UnlockRealArea
  85.  
  86.     If    &TYPE('&Dispatcher') ≠ 'UNDEFINED' Then
  87.         Setup    OpenDispatch
  88.         Setup    CloseDispatch
  89.     EndIf
  90. *
  91. *  Return the pointer to the Address table
  92. *
  93.         Lea        RsrcHandle, A0
  94.         Move.L    A0, D0
  95.         Rts
  96.         SubrName    SetupAddresses
  97. *
  98. *    Queue table with address of the routines
  99. *
  100.             Export    QueueEntry
  101. QueueEntry    Equ        *
  102.  
  103. RsrcHandle    Ds.L    1            ; Place to save the handle to the resource
  104. *
  105. *  Address of the routines
  106. *
  107. Addresses
  108. *
  109. *     There are twenty one routines in A/ROSE
  110. *     Two routines for message dispatcher
  111. *
  112.         SetupLabel    CloseQueue
  113.         SetupLabel    FreeMsg
  114.         SetupLabel    GetCard
  115.         SetupLabel    GetETick
  116.         SetupLabel    GetICCTID
  117.         SetupLabel    GetIPCg
  118.         SetupLabel    GetMsg
  119.         SetupLabel    GetNameTID
  120.         SetupLabel    GetTickPS
  121.         SetupLabel    GetTID
  122.         SetupLabel    IsLocal
  123.         SetupLabel    KillReceive
  124.         SetupLabel    LockRealArea
  125.         SetupLabel    Lookup_Task
  126.         SetupLabel    NetCopy
  127.         SetupLabel    OpenQueue
  128.         SetupLabel    Receive
  129.         SetupLabel    Register_Task
  130.         SetupLabel    Send
  131.         SetupLabel    SwapTID
  132.         SetupLabel    UnlockRealArea
  133. *
  134. *  Setup label for Message dispatcher calls only if the option is specified
  135. *
  136.     If    &TYPE('&Dispatcher') ≠ 'UNDEFINED' Then
  137.         SetupLabel    OpenDispatch
  138.         SetupLabel    CloseDispatch
  139. *
  140. *  Pointer to the handle Dispatch table
  141. *
  142.                 Export    dispatchTblHdl
  143. dispatchTblHdl    Ds.L    1            ; Handle to the dispatch table
  144. *
  145. *  Pointer to the message queue
  146. *
  147.                 Export    messageQueueHdl
  148. messageQueueHdl    Ds.L    1            ; Where messages are queued
  149.                 Export    messageQueueSize
  150. messageQueueSize    Ds.L    1        ; Message queue size
  151. *
  152.     EndIf
  153. *
  154.             Rts
  155.             SubrName    QueueEntry
  156.         EndMain
  157.     If    &TYPE('&Dispatcher') ≠ 'UNDEFINED' Then
  158. *
  159. *  Set special receive
  160. *
  161. SetSpecialReceive    Proc    Export
  162.         Import    SpecialReceive
  163.         Lea        SpecialReceive, A0        ; Setup the special receive address
  164.         Lea        aReceive, A1
  165.         Move.L    A0, (A1)
  166.         Rts
  167.         SubrName    SetSpecialReceive
  168.         EndProc
  169. *
  170. *  Restore original receive
  171. *
  172. RestoreOriginalReceive    Proc    Export
  173.         Import    Receive
  174.         Lea        Receive, A0
  175.         Lea        aReceive, A1
  176.         Move.L    A0, (A1)            ; restore original receive address
  177.         Rts
  178.         SubrName    RestoreOriginalReceive
  179.         EndProc
  180.     EndIf
  181.         End